import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '适用宝类型',
    key: 'charge_leixing',
    align: "center",
    width: 140,
    render(row) {
      if (row.charge_leixing == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('普通宝、快充宝'),
          },
        );
      } else if (row.charge_leixing == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('普通宝'),
          },
        );
      } else if (row.charge_leixing == 3) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('快充宝'),
          },
        );
      }
    }
  }, {
    title: '会员卡类型',
    key: 'title',
    align: "center",
    width: 100
  }, {
    title: '用户名称',
    key: 'usersname',
    align: "center",
  }, {
    title: '用户会员号',
    key: 'member_card',
    align: "center",
  }, {
    title: '适用商户',
    key: 'bussiness_name',
    align: "center",
  }, {
    title: '减免类型',
    key: 'jm_leixing',
    align: "center",
    render(row) {
      if (row.jm_leixing == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('时长'),
          },
        );
      } else if (row.jm_leixing == 2) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('金额'),
          },
        );
      }
    }
  }, {
    title: '单次减免时长',
    key: 'shichang',
    align: "center",
  }, {
    title: '单次减免金额',
    key: 'jine',
    align: "center",
  }, {
    title: '单日可用次数',
    key: 'cishu',
    align: "center",
  }, {
    title: '到期时间',
    key: 'daoqi_time',
    align: "center",
  }
];
